<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/template.xhtml">


        <ui:define name="title">
            <h:outputText value="#{bundle.ListCategoriaTitle}"></h:outputText>
        </ui:define>

        <ui:define name="body">
            <h:form id="CategoriaListForm">
                <p:panel header="#{bundle.ListCategoriaTitle}">
                    <p:dataTable id="datalist" value="#{categoriaController.items}" var="item"
                                 selectionMode="single" selection="#{categoriaController.selected}"
                                 paginator="true"
                                 rowKey="#{item.idcategoria}"
                                 rows="10"
                                 rowsPerPageTemplate="10,20,30,40,50"
                                 >

                        <p:ajax event="rowSelect"   update="viewButton"/>
                        <p:ajax event="rowUnselect" update="viewButton"/>

                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListCategoriaTitle_idcategoria}"/>
                            </f:facet>
                            <h:outputText value="#{item.idcategoria}"/>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListCategoriaTitle_nmbcategoria}"/>
                            </f:facet>
                            <h:outputText value="#{item.nmbcategoria}"/>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListCategoriaTitle_dsccategoria}"/>
                            </f:facet>
                            <h:outputText value="#{item.dsccategoria}"/>
                        </p:column>
                        <f:facet name="footer">
                            <p:commandButton id="viewButton"   icon="ui-icon-search" value="#{bundle.View}" update=":CategoriaViewForm" oncomplete="PF('CategoriaViewDialog').show()" disabled="#{empty categoriaController.selected}"/>
                        </f:facet>
                    </p:dataTable>
                </p:panel>
            </h:form>
            <ui:include src="View.xhtml"/>
        </ui:define>
    </ui:composition>

</html>
